<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="author" content="wangbo" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>Document</title>
</head>

<body>
	<script type="text/javascript" >
		// 函数和java的方法一样
		// function 表示是函数 函数名(字母,数字,下划线,$,区分大小写)()
		function add(a, b) {
			console.log(a + b)
		}
		add(1, 2)
		// 指向匿名函数,表达式函数
		let sum = function (a, b) {
			console.log(a + b)
			return 4;
			// return 可以返回任意的类型
			console.log("---------------")
		}
		let back = sum(1, 2)
		console.log(back)
		// 箭头函数(重点,了解)
		let sum2 = (a, b) => {
			console.log(a + b)
		}
		sum2(1, 2)

		var sayHi = new Function("console.log('Hello');");
		sayHi()
		var doAdd = new Function("iNum", "console.log(iNum + 10)");
		doAdd(10);
	</script>
</body>

</html>